package com.tanhua.server.controller;

import com.tanhua.server.interceptor.UserHolder;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/huanxin")
public class HuanxinController {

    /**
     * 查询当前用户在环信的账号
     * 接口路径：GET /user
     * 返回值：
     *  username，password
     */
    @GetMapping("/user")
    public ResponseEntity user() {
        //用户id和环信关系：hx+userId , 密码：123456
        Map<String,String> map = new HashMap<>();
        map.put("username","hx"+ UserHolder.getUserId());
        map.put("password","123456");
        return ResponseEntity.ok(map);
    }
}
